package someTestExcemple.huaweiOd.string;


//华为OD机试 - 按单词下标区间翻转文章内容（Java 2025 A卷 100分）
//https://blog.csdn.net/guorui_java/article/details/132250588
import java.util.*;

public class FlipTheContentOfTheArticle {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String[] words = sc.nextLine().trim().split("\\s");
        String[] input1 = sc.nextLine().split(" ");
        int begin = Integer.parseInt(input1[0]);
        int end = Integer.parseInt(input1[1]);
        //区间内单词进行反转
        if(begin >=0 && end < words.length) {
            int left = begin,right = end;
            while(left<right) {
                String temp = words[left];
                words[left] = words[right];
                words[right] =temp;
                left++;
                right--;
            }
        }
        StringJoiner result = new StringJoiner(" ");
        for(int i=0;i< words.length;i++) {
            result.add(words[i]);
        }
        System.out.println(result);
    }
}
/**
 * nezha love study java !
 * 1 3
 *
 * 2、输出
 * nezha java study love !
 */